<%-- 
    Document   : index1
    Created on : Nov 27, 2013, 11:01:31 PM
    Author     : Huyen
--%>
<%@page import="bc.entity.Congty"%>
<%@page import="businesscard.DAO.CongtyDAO"%>
<%@page import="bc.entity.Bophan"%>
<%@page import="businesscard.DAO.BophanDAO"%>
<%@page import="bc.entity.Nhomnganh"%>
<%@page import="businesscard.DAO.NhomnganhDAO"%>
<%@page import="bc.entity.Capbac"%>
<%@page import="businesscard.DAO.CapbacDAO"%>
<%@page import="bc.entity.Nganh"%>
<%@page import="businesscard.DAO.NganhDAO"%>
<%@page import="bc.entity.Thanhpho"%>
<%@page import="businesscard.DAO.ThanhphoDAO"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="businesscard.DAO.UserDAO"%>
<%@page import="bc.entity.User"%>
<%@page import="bc.entity.Thanhtoan"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link rel="stylesheet" href="css/style.css" type="text/css"/>
        <link rel="stylesheet" href="css/bocuc.css" type="text/css"/>
        <link rel="stylesheet" href="css/testcss.css" type="text/css"/>
        <link rel="stylesheet" href="css/mystyle.css" type="text/css"/>
        <link rel="stylesheet" href="css/botoncss.css" type="text/css"/>
        <link rel="stylesheet" href="css/trangcanhan.css" type="text/css"/>
        <script type="text/javascript" src="jquery/jquery-1.1.3.1.min.js"></script> 
        <script type="text/javascript" src="jquery/jquery-1.4.2.js"></script> 
        <script type="text/javascript" src="jquery/jquery-latest.js"></script>
        <script type="text/javascript" src="jquery/myjquery.js"></script>
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

        <title>Businesscard</title>
         <script type="text/javascript" src="jquery/jquery-1.8.0.min.js"></script>

      
          <script type="text/javascript" >
              
            $(function() {
                $(".inputsearch").keyup(function()
                {
                    var searchid = $(this).val();
                    var dataString = 'search=' + searchid;
                    if (searchid !== '')
                    {
                        $.ajax({
                            type: "POST",
                            url: "searchAjax.jsp",
                            data: dataString,
                            cache: false,
                            success: function(html)
                            {
                                $("#showhint").html(html).show();
                            }
                        });
                    }else{
                         jQuery("#showhint").hide();
                    }
                    return false;
                });

                jQuery("#showhint").live("click", function(e) {
                    var $clicked = $(e.target);
                    var $name = $clicked.find('.name').html();
                    var decoded = $("<div/>").html($name).text();
                    $('#searchid').val(decoded);
                });
                jQuery(document).live("click", function(e) {
                    var $clicked = $(e.target);
                    if (!$clicked.hasClass("inputsearch")) {
                        jQuery("#showhint").fadeOut();
                    }
                });
                $('#searchid').click(function() {
                    jQuery("#showhint").fadeIn();
                });
                
            });
        </script>
        <style type="text/css">
         //body{ 
         //       font-family:Tahoma, Geneva, sans-serif;
         //       font-size:18px;
         //   }
        //    .content{
        //        width:900px;
        //        margin:0 auto;
        //    }
            .name{
                width:446px;
                
                margin-top:-1px !important;
                background-color:transparent !important;
                margin-left:0;}
            #showhint
            {
                position:absolute;
                width:446px;
                padding:10px;
                display:none;
                margin-top:-1px;
                border-top:0px;
                overflow:hidden;
                border:1px #CCC solid;
                background-color: white;
                margin-left: 423px;
            }
            .show
            {
                padding:10px; 
                border-bottom:1px #999 dashed;
                font-size:15px; 
                height:50px;
            }
            .show:hover
            {
                background:#4c66a4;
                color:#FFF;
                cursor:pointer;
            }
            .name:hover
            {
                background:#4c66a4;
                color:#FFF;
                cursor:pointer;
            }
        </style>
        <script>
            var xmlhttp;
            function get_nganh()
            {
                xmlhttp = GetXmlHttpObject();

                if (xmlhttp == null)
                {
                    alert("Your browser does not support Ajax HTTP");
                    return;
                }
                var nhomNganh = document.getElementById("txtNhomnganh").value;

                var url = "getNganh.jsp";
                url = url + "?nhom=" + nhomNganh;

                xmlhttp.onreadystatechange = getOutput;
                xmlhttp.open("GET", url, true);
                xmlhttp.send(null);

            }
            function getOutput()
            {
                if (xmlhttp.readyState == 4 || xmlHttp.readyState == "complete")
                {
                    document.getElementById("txtNganh").innerHTML = xmlhttp.responseText;
                }
            }
            function getOutputQuan()
            {
                if (xmlhttp.readyState == 4 || xmlHttp.readyState == "complete")
                {
                    document.getElementById("txtQuanhuyen").innerHTML = xmlhttp.responseText;
                }
            }
            function get_Quanhuyen() {
                xmlhttp = GetXmlHttpObject();

                if (xmlhttp == null)
                {
                    alert("Your browser does not support Ajax HTTP");
                    return;
                }
                var thanhpho = document.getElementById("txtThanhpho").value;

                var url = "getQuanhuyen.jsp";
                url = url + "?thanhpho=" + thanhpho;

                xmlhttp.onreadystatechange = getOutputQuan;
                xmlhttp.open("GET", url, true);
                xmlhttp.send(null);
            }
            function GetXmlHttpObject()
            {
                if (window.XMLHttpRequest)
                {
                    return new XMLHttpRequest();
                }
                if (window.ActiveXObject)
                {
                    return new ActiveXObject("Microsoft.XMLHTTP");
                }
                return null;
            }
        </script>
    </head>
    <body >
        <div class="bodypage">
            <!phan dau cua trang>
            <div class="top">
                <%@include file='header.jsp'%>
            </div>
            <!phan search>
            <div class="khoangcachtrang">
                <div class="searchgroup">

                    <%@include file='search.jsp' %> 
                    <div class="chontimkiem">
                        <a href="timkiemnangcao.jsp">Tìm Kiếm Nâng Cao</a>
                    </div>

                </div>
            </div>
            <!phan giua trang >
            <div class="centerpage">

                <div class="leftsite">
                    <div class="menuweb">
                        <%@include file='menuleft.jsp' %>
                    </div>
                </div>

                <div class="contentCanhan">
                    <div class="khoangtrang"></div>
                    <%@include file='leftCanhan.jsp' %>
                    <div class="rightcontent">
                        <div class="txtThemLienhe">
                            <h1>Thêm liên hệ</h1>
                            <form action="AddContactController" method="post">
                                <div class=""> Tên liên hệ
                                    <input type="text" name="txtTen"/>
                                </div>
                                <div> Tỉnh/Thành phố
                                    <select name="txtThanhpho" id="txtThanhpho" onchange="get_Quanhuyen();">
                                        <%
                                            ThanhphoDAO A = new ThanhphoDAO();
                                            Thanhpho[] B = A.getAllThanhpho();
                                            for (int i = 0; i < B.length; i++) {
                                        %>
                                        <option  value= <%=B[i].getIdThanhpho()%> > <%=B[i].getThanhpho()%></option>
                                        <%
                                            }
                                        %>
                                    </select>
                                </div>
                                <div id="txtQuanhuyen" name="txtQuan"></div>
                                <div id="txtDiachi" style="margin-top: 20px;" > Địa chỉ
                                    <input type="text" name="txtDiachi"/>
                                </div>
                                <div> Email liên lạc
                                    <input type="text" name="txtEmail"/>
                                </div>
                                <div> Số điện thoại cố định
                                    <input type="text" name="txtSocd"/>
                                </div>
                                <div> Số điện thoại di động
                                    <input type="text" name="txtSodd"/>
                                </div>
                                <div>Fax:
                                    <input type="text" name="txtFax"/>
                                </div>
                                <div> Nhóm ngành
                                    <select name="txtNhomnganh" id="txtNhomnganh" onchange="get_nganh();" >
                                        <option placeholder="chọn ngành"> chọn ngành</option>
                                        <%
                                            NhomnganhDAO nhomnganhDAO = new NhomnganhDAO();
                                            Nhomnganh[] nhomnganh = nhomnganhDAO.getAllNhomnganh();
                                            for (int i = 0; i < nhomnganh.length; i++) {
                                        %>
                                        <option  value= <%=nhomnganh[i].getIdNhomnganh()%> > <%=nhomnganh[i].getNhomnganh()%></option>
                                        <%
                                            }
                                        %>
                                    </select>
                                </div>
                                <div id="txtNganh" name="txtNganh">

                                </div>
                                <div> Cấp bậc
                                    <select name="txtCapbac">
                                        <option>Chọn cấp bậc</option>
                                        <%
                                            CapbacDAO capbacDAO = new CapbacDAO();
                                            Capbac[] capbac = capbacDAO.getAllCapbac();
                                            for (int i = 0; i < capbac.length; i++) {
                                        %>
                                        <option  value= <%=capbac[i].getIdCapbac()%> > <%=capbac[i].getCapbac()%></option>
                                        <%
                                            }
                                        %>
                                    </select>
                                </div>
                                <div> Bộ phận
                                    <select name="txtBophan">
                                        <option>Chọn bộ phận</option>
                                        <%
                                            BophanDAO bophanDAO = new BophanDAO();
                                            Bophan[] bophan = bophanDAO.getAllBophan();
                                            for (int i = 0; i < bophan.length; i++) {
                                        %>
                                        <option  value= <%=bophan[i].getIdBophan()%> > <%=bophan[i].getBophan()%></option>
                                        <%
                                            }
                                        %>
                                    </select>
                                </div>   
                                <div> Làm việc tại công ty
                                    <select name="txtCongty">
                                        <option>Chọn công ty</option>
                                        <%
                                            CongtyDAO congtyDAO = new CongtyDAO();
                                            Congty[] congty = congtyDAO.getAllCongty();
                                            for (int i = 0; i < congty.length; i++) {
                                        %>
                                        <option  value= <%=congty[i].getIdCongty()%> > <%=congty[i].getCongty()%></option>
                                        <%
                                            }
                                        %>
                                    </select>
                                    <a href="themcongty.jsp">Bạn có muốn thêm công ty?</a>
                                </div>
                                <div> 
                                    <input type="submit" value="Add Contact" name="action"/>
                                    <input type="reset" value="Reset"/>
                                </div>
                            </form>
                        </div>

                    </div>
                </div>

                <div class="khoangtrang"></div>
            </div>


        </div>
        <!phan cuoi trang>
    <div class="footer">
        <div class="footerleft"></div>
        <div class="footerright"></div>
    </div>



</body>
</html>
